package com.bawei.yangzongcai___day2.MaiDongFangHong.day6;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.bawei.yangzongcai___day2.MaiDongFangHong.day5.MaiDongFangHong5;
import com.bawei.yangzongcai___day2.R;
import com.blankj.utilcode.util.ToastUtils;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
@Route(path = "/xinwei8s/maidongfanghong6s")
public class MaiDongFangHong6 extends AppCompatActivity implements View.OnClickListener {
    private ImageView iv_showCode;
    private String code;
    private ImageView showCode;
    private ImageView dongtu;
    @Autowired
    String hehe;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mai_dong_fang_hong6);
        initView();
       ARouter.getInstance().inject(this);
       ToastUtils.showShort(hehe);
        //初始化显示验证码控件
        iv_showCode = (ImageView) findViewById(R.id.showCode);
        //将验证码用图片的形式显示出来
        iv_showCode.setImageBitmap(Code.getInstance().createBitmap());
        //获取验证码值
        code = Code.getInstance().getCode().toLowerCase();
        //验证码添加点击事件
        iv_showCode.setOnClickListener(this);

        String ditu = "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.mp.itc.cn%2Fupload%2F20170324%2Fe6c3cb70b9764b5ea06293039e5f2bfe_th.gif&refer=http%3A%2F%2Fimg.mp.itc.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1630035069&t=7225916aedf582843db4bfe0b1d5135f";
        Glide.with(this).load(ditu).circleCrop().centerCrop().into(dongtu);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
//验证码点击事件
            case R.id.showCode:
                //设置新的验证码
                iv_showCode.setImageBitmap(Code.getInstance().createBitmap());
                //获取验证码值
                code = Code.getInstance().getCode().toLowerCase();
                Log.v("realCode---------->", code);
                break;
        }
    }

    private void initView() {
        showCode = findViewById(R.id.showCode);
        dongtu = findViewById(R.id.dongtu);
    }
}
